package com.yanchangapp.util;

import com.haibin.calendarview.Calendar;

/**
 * Created by apple on 2019-10-11.
 * description:日历帮助工具...
 */
public class CalendarHelper {
    public static boolean isAfterToday(Calendar calendar){
        java.util.Calendar todayCalendar = java.util.Calendar.getInstance();
        java.util.Calendar curCalendar = java.util.Calendar.getInstance();
        curCalendar.set(calendar.getYear(),calendar.getMonth()-1,calendar.getDay());
        return !curCalendar.before(todayCalendar);
    }

    public static boolean isYesterDay(Calendar calendar){
        java.util.Calendar todayCalendar = java.util.Calendar.getInstance();
        // 昨天
        todayCalendar.add(java.util.Calendar.DAY_OF_MONTH,-1);
        java.util.Calendar curCalendar = java.util.Calendar.getInstance();
        curCalendar.set(calendar.getYear(),calendar.getMonth()-1,calendar.getDay());
        return todayCalendar.equals(curCalendar);
    }
}
